<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;

class Specs extends Base
{
    use SoftDeletes;
    protected $table = 'mall_specs';

    public static function fetch_title($id) {
        $key = 'cache_specs';
        $arr= \Cache::rememberForever($key, function () {
            return Specs::withTrashed()->get()->pluck('title', 'id')->all();
        });
        return $arr[$id] ?? '';
    }

    public static function clear_cache() {
        $key = 'specs';;
        \Cache::forget($key);
    }

}
